package com.ys.peony.ui.widget;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.ys.peony.R;

/**
 * Created by yml on 16/7/5.
 */
public class CustomProgressDialog extends ProgressDialog {

    private Context mContext;
//    private ImageView         mImageView;
    private ProgressBar         mImageView;
    private String            mLoadingTip;
    private TextView          mLoadingTv;

    public CustomProgressDialog(Context context, String content) {
        super(context, R.style.mydialog);
        this.mContext = context;
        this.mLoadingTip = content;
        setCanceledOnTouchOutside (true);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate (savedInstanceState);
        initView ();
        initData ();
    }

    private void initData(){

        // 加载动画
//        Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(
//                mContext, R.anim.custom_progress_img_anim);
//        mImageView.startAnimation(hyperspaceJumpAnimation);
        mLoadingTv.setText (mLoadingTip);

    }

    public void setContent(String str){
        mLoadingTv.setText (str);
    }

    private void initView(){
        setContentView (R.layout.progress_dialog);
        mLoadingTv = (TextView) findViewById (R.id.loading_tv);
//        mImageView = (ProgressBar) findViewById (R.id.loading_img);

    }

}
